package com.yhny.lykj.yuhannongye.ui;

import android.content.Intent;
import android.view.View;

import com.longsichao.lscframe.model.LSCModel;
import com.longsichao.lscframe.net.Api;
import com.yhny.lykj.yuhannongye.Adapter.OrderPayListAdapter;
import com.yhny.lykj.yuhannongye.R;
import com.yhny.lykj.yuhannongye.app.BaseRefreshListAdapter;
import com.yhny.lykj.yuhannongye.app.BaseRefreshListFragment;
import com.yhny.lykj.yuhannongye.model.OrderListModel;
import com.yhny.lykj.yuhannongye.net.NetHelper;
import com.yhny.lykj.yuhannongye.tools.LCLog;

import java.util.List;

/**
 * 待支付订单
 * Created by lc on 2017/2/1.
 */
public class OrderPayFragment extends BaseRefreshListFragment<OrderListModel.ListEntity> implements BaseRefreshListAdapter.OnItemClickListener {
    @Override
    protected Boolean isGridView() {
        return false;
    }

    @Override
    protected String setTipText() {
        return "无待发货订单";
    }

    @Override
    protected Api getApi(int page) {
                return NetHelper.Order.getOrderList("0",page);
    }

    @Override
    protected boolean canLoadMore() {
        return false;
    }

    @Override
    protected BaseRefreshListAdapter getRefreshListAdapter() {
        OrderPayListAdapter adapter = new OrderPayListAdapter(getDataList(),getActivity());
        adapter.setOnItemClickListener(this);
        return adapter;
    }

    @Override
    protected List<OrderListModel.ListEntity> getModelDataList(LSCModel model) {
        OrderListModel orderListModel =(OrderListModel)model;
        LCLog.e("orderListModel.size="+orderListModel.list.size());
        return orderListModel.list;
    }

    @Override
    protected void onSetContentViewAfter(View rootView) {
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.fragment_order;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){



        }
        super.onClick(v);
    }


    @Override
    public void onItemClick(int position) {

        Intent intent = new Intent(getActivity(),OrderInfoActivity.class);
        intent.putExtra(FROM_TYPE_ID,FROM_TYPE_VIEW_ORDER_LIST);
        intent.putExtra(ORDER_ID,getDataList().get(position).ordernumber);
        startActivity(intent);

    }
}
